package com.sxj.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * 2024年07月23日 13:46
 */
public class Emp implements CompareInterface<Emp> {
    private String name;
    private Double salary;

    public Emp() {
    }

    public Emp(String name, Double salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }

    @Override
    public int compareTo(Emp emp) {
        if (this.salary > emp.getSalary()) {
            return 1;
        }
        if (this.salary < emp.getSalary()) {
            return -1;
        }
        return 0;
    }
}
